/************************************************************************************
*
*  By JobGoo@gmail.com
*************************************************************************************/
#ifndef __icm_3api_h__
#define  __icm_3api_h__

#ifdef __cplusplus
extern "C" {
#endif

#include <icm_3.h>

enum ICM_OPEN_MODE
{
	ICM_CREATE = 0,
	ICM_OPEN
};

/************************************************************************************
* file operation
*************************************************************************************/
int icm_open_file(const char *file_name, unsigned int flag);

int icm_create_file(const char *file_name);

void icm_close_file(int fd);

int icm_write_data(int fd, unsigned int len, const char *buf);

int icm_read_data(int fd, unsigned int len, char *buf);

int icm_read_block(int fd, unsigned int block_no, unsigned int block_len, char *buf);

int icm_get_block(const char *hash, unsigned int hash_len, char *buf, unsigned int buf_len);

int icm_put_block(const char *hash, unsigned int hash_len, const char *buf, unsigned int buf_len);

int icm_list_file(unsigned long list_seq, char *file_name, unsigned int len);

void icm_remove_file(const char *file_name);


/************************************************************************************
* meta operation
*************************************************************************************/
int icm_open_meta(const char *file_name, unsigned int flag);

int icm_write_meta(int fd, unsigned int len, const char *buf);

int icm_read_meta(int fd, unsigned int len, char *buf);

int icm_close_meta(int fd);

int icm_query_block(BLOCK_HASH_QUERY *block_query, BLOCK_ADDR_INFO *addr_info);



#ifdef __cplusplus
}
#endif

#endif

